`timescale 1ns / 1ps

module DREXT(
    input [31:0] AO,
    input [31:0] DR,
    input [2:0] Dop,
    output [31:0] DEO
);

    assign DEO = (Dop == 3'b000)? DR :
                 (Dop == 3'b001)? {{16{DR[15+AO[1]*16]}}, DR[AO[1]*16 +: 16]} :  // hw s
                 (Dop == 3'b010)? {16'h00,                DR[AO[1]*16 +: 16]} :  // hw u
                 (Dop == 3'b011)? {{24{DR[7+AO[1:0]*8]}}, DR[AO[1:0]*8 +: 8]} :  // b s
                 (Dop == 3'b100)? {24'h00,                DR[AO[1:0]*8 +: 8]} :  // b u
                                0;
										  
endmodule